<?php

declare(strict_types=1);

namespace App\Controller\Admin\V1\Publics;

use App\Controller\Admin\V1\Controllers;
use App\Services\Admin\Menu as MenuServices;
use Hyperf\Context\Context;

class Index extends Controllers
{
    public function __construct(
        protected MenuServices $menuServices
    )
    {
        parent::__construct();
    }

    public function index()
    {
        $menu = $this->menuServices->getTree(Context::get('adminInfo'));

        return success([
            'menu' => $menu
        ]);
    }
}
